import { Injectable } from '@angular/core';
import { HOSTURL, PREFIX } from '../../../config';
import { RequestClientService } from '../../request-client.service';
@Injectable({
  providedIn: 'root'
})

export class DepartmentService {

  constructor(
    private requestClientService: RequestClientService
  ) { }
  // 获取部门
  public async GetOrganizationUnits(params?) {
    const res = await this.requestClientService.get(HOSTURL + `/api/services/${PREFIX}/OrganizationUnit/GetOrganizationUnits`, params);
    return res;
  }
  // 编辑部门
  public async UpdateOrganizationUnit(params?) {
    // tslint:disable-next-line: max-line-length
    const res = await this.requestClientService.put(HOSTURL + `/api/services/${PREFIX}/OrganizationUnit/UpdateOrganizationUnitExtend`, params);
    return res;
  }
  // 创建部门
  public async CreateOrganizationUnitExtend(params?) {
    // tslint:disable-next-line: max-line-length
    const res = await this.requestClientService.post(HOSTURL + `/api/services/${PREFIX}/OrganizationUnit/CreateOrganizationUnitExtend`, params);
    return res;
  }
  // 删除部门
  public async DeleteOrganizationUnit(params?) {
    // tslint:disable-next-line: max-line-length
    const res = await this.requestClientService.delete(HOSTURL + `/api/services/${PREFIX}/OrganizationUnit/DeleteOrganizationUnit`, params);
    return res;
  }
  // 拖动修改部门结构
  public async MoveOrganBySort(params?) {
    // tslint:disable-next-line: max-line-length
    const res = await this.requestClientService.post(HOSTURL + `/api/services/${PREFIX}/OrganizationUnit/MoveOrganBySort`, params);
    return res;
  }
  public async BatchMoveOrganBySort (params?) {
    // tslint:disable-next-line: max-line-length
    const res = await this.requestClientService.post(HOSTURL + `/api/services/${PREFIX}/OrganizationUnit/BatchMoveOrganizationBySort
    `, params);
    return res;
  }

}